/**
 * 
 */
package com.jframework.module.usps.Services;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.jframework.module.usps.USPSConstants;
import com.jframework.module.usps.beans.USPSBaseResponseObject;
import com.jframework.module.usps.beans.rates.IntlRateResponse;


/**
 * @author AJain
 *
 */

public class USPSIntlRateService extends USPSBaseService 
{
    static Log log = LogFactory.getLog(USPSIntlRateService.class);
    
    /* (non-Javadoc)
     * @see com.jframework.module.usps.Services.USPSService#doService(java.util.Map)
     */
    public USPSBaseResponseObject  doService(Map parameters) throws Exception 
    {
	this.setAPIName(USPSConstants.API_TYPE_IntlRate);
	IntlRateResponse responseObject = (IntlRateResponse)this.makeUSPSCall(IntlRateResponse.class);
	
	if (null != responseObject 
	 && null != responseObject.getPackage()
	 && null != responseObject.getPackage()[0]
	 && null != responseObject.getPackage()[0].getError())
	{
	    responseObject.setError(responseObject.getPackage()[0].getError());  
	}
	
	return responseObject;
    }

}
